Skip to content

feat(ev-dev): part 5 – add interactive TUI dashboard#184

Draft
randygrok wants to merge 7 commits intoev-deployer-part4-ev-dev-integrationfrom
feat/ev-dev-part5-tui
Draft

feat(ev-dev): part 5 – add interactive TUI dashboard#184
randygrok wants to merge 7 commits intoev-deployer-part4-ev-dev-integrationfrom
feat/ev-dev-part5-tui

Conversation

@randygrok
Copy link
Contributor

Description

Adds an interactive terminal UI dashboard to ev-dev with the --tui flag. The TUI displays real-time blocks, logs, and accounts panels using ratatui, with a custom tracing layer that captures log events in real-time. Plain log output remains the default behavior.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • TUI renders blocks, logs, and accounts panels
  • Keyboard navigation works (Tab, arrows, q to quit)
  • Terminal properly restored on exit or panic
  • Plain log output mode (--tui off) unchanged

- Integrate ratatui for terminal UI with blocks, logs, and accounts panels
- Implement custom tracing layer to capture real-time log events
- Add keyboard navigation (Tab for panel switch, arrows for scroll, q to quit)
- Support coexistence of TUI and plain log output modes
- Add crossterm for terminal event handling
@randygrok randygrok requested a review from a team as a code owner March 20, 2026 08:33
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 273e3747-793e-42cd-a48b-2ecca942d43c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ev-dev-part5-tui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude
Copy link

claude bot commented Mar 20, 2026

Claude finished @randygrok's task —— View job


Code Review Complete ✅

I've thoroughly reviewed this PR and the TUI implementation looks well-architected! Here's my comprehensive feedback:

Todo List:

  • Read and analyze the main changes in bin/ev-dev/src/main.rs
  • Review the TUI module architecture and implementation
  • Check the tracing layer implementation for proper log capture
  • Assess error handling and resource management
  • Look for security concerns and performance issues
  • Evaluate test coverage and suggest improvements
  • Provide comprehensive review feedback

Code Quality & Architecture

Excellent structure and design:

  • Clean separation of concerns with dedicated modules (app.rs, ui.rs, events.rs, tracing_layer.rs)
  • Well-organized state management in App struct with logical grouping of fields
  • Good use of VecDeque for bounded collections with proper size limits (MAX_LOGS: 1000, MAX_BLOCKS: 200)
  • Proper resource cleanup with TerminalGuard and panic hook restoration

Strong implementation patterns:

  • Effective use of tokio::select! for concurrent event handling in tui/mod.rs:46-64
  • Good separation between TUI and non-TUI modes in main.rs:265-269
  • Custom tracing layer integration that properly intercepts reth's logging without conflicts

Error Handling & Robustness

Proper error handling throughout:

  • Graceful terminal restoration on panic with custom panic hook (tui/mod.rs:29-34)
  • TerminalGuard Drop impl ensures cleanup even on unexpected exits (tui/mod.rs:19-26)
  • Fallback handling for failed RPC calls (app.rs:343-346)
  • Channel error handling with proper task termination (app.rs:349-352)

Security Assessment

No security concerns identified:

  • Private keys are handled appropriately for a development tool context
  • No credential exposure beyond the expected development environment scope
  • Input validation present where needed (key event filtering, field parsing)

⚠️ Performance Considerations

Potential optimizations to consider:

  1. Balance polling frequency (app.rs:334):

    let mut interval = tokio::time::interval(std::time::Duration::from_secs(2));
    • 2-second polling might be aggressive for a dev tool
    • Consider making this configurable or increase to 5 seconds
  2. Log processing efficiency (app.rs:122-138):

    • Currently processes all log entries on every tick
    • For high-volume logging, consider batching or debouncing log updates
  3. String allocations in UI rendering:

    • Multiple string formatting operations on each render
    • Consider caching formatted strings for static data

Test Coverage Gap

Major concern: No test coverage found

  • No test files detected in the TUI module
  • No unit tests for critical components like:
    • Log parsing logic (app.rs:141-170)
    • Event handling (events.rs)
    • Balance formatting (app.rs:304-319)
    • Block detail fetching (app.rs:232-283)

Recommended test additions:

#[cfg(test)]
mod tests {
    use super::*;
    
    #[test]
    fn test_parse_block_from_fields() {
        // Test block info parsing logic
    }
    
    #[test]  
    fn test_format_ether() {
        // Test ETH value formatting
    }
    
    #[test]
    fn test_key_navigation() {
        // Test panel navigation and selection
    }
}

🔧 Minor Issues & Suggestions

  1. Magic numbers (ui.rs:135-140):

    • Hard-coded height calculations could be extracted to constants
  2. Error message improvements (app.rs:345):

    Err(_) => balances.push("? ETH".to_string()),
    • Consider more descriptive error states
  3. Clippy suggestions:

    • Several const fn opportunities in constructors
    • Some string allocations could be avoided

📊 Overall Assessment

This is a well-implemented feature that adds significant value to the development experience. The architecture is sound, error handling is comprehensive, and the code follows good Rust practices.

Priority recommendations:

  1. Add comprehensive unit tests - This is the main gap
  2. Consider performance tuning for the balance polling interval
  3. Add integration tests for the full TUI workflow

The implementation demonstrates strong understanding of async Rust, proper terminal handling, and clean separation of concerns. Great work! 🚀


@randygrok randygrok changed the title feat(ev-dev): add interactive TUI dashboard feat(ev-dev): part 5 – add interactive TUI dashboard Mar 20, 2026
@randygrok randygrok marked this pull request as draft March 20, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants